/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package graphic;

import exceptions.CaminhoIncorreto;
import exceptions.IndiceInvalido;
import exceptions.NaoEhDiretorio;
import java.io.IOException;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import main.BuscaArquivo;

/**
 *
 * @author WorkSpace
 */
public class Principal extends javax.swing.JFrame {

    /**
     * Creates new form Principal
     */
    public Principal() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        Abas = new javax.swing.JTabbedPane();
        Configuração = new javax.swing.JPanel();
        center_x = new javax.swing.JTextField();
        center_y = new javax.swing.JTextField();
        center_z = new javax.swing.JTextField();
        sizeX = new javax.swing.JTextField();
        sizeY = new javax.swing.JTextField();
        sizeZ = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel10 = new javax.swing.JLabel();
        pathLigante = new javax.swing.JTextField();
        pathProteina = new javax.swing.JTextField();
        bPesquisarProteina = new javax.swing.JButton();
        bPesquisarLigante = new javax.swing.JButton();
        bGravaConfig = new javax.swing.JButton();
        bLerConfig = new javax.swing.JButton();
        bExecutaVina = new javax.swing.JButton();
        GeraPlanilha = new javax.swing.JPanel();
        bPesquisar = new javax.swing.JButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        cSaida = new javax.swing.JTextArea();
        cCaminho = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        bListarMelhores = new javax.swing.JButton();
        caixaLM = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        caixaLP = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        bListarPiores = new javax.swing.JButton();
        bLimparT = new javax.swing.JButton();
        bGeraPlanilha = new javax.swing.JButton();
        bTodosOsCasos = new javax.swing.JButton();
        VizualizaDados = new javax.swing.JPanel();
        cCaminho1 = new javax.swing.JTextField();
        bPesquisar1 = new javax.swing.JButton();
        bLimparT1 = new javax.swing.JButton();
        jScrollPane4 = new javax.swing.JScrollPane();
        cSaida1 = new javax.swing.JTextArea();
        jScrollPane5 = new javax.swing.JScrollPane();
        cSaida2 = new javax.swing.JTextArea();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Vina - Plugin");
        setMinimumSize(new java.awt.Dimension(700, 450));

        Abas.setMaximumSize(new java.awt.Dimension(650, 400));
        Abas.setMinimumSize(new java.awt.Dimension(650, 400));
        Abas.setPreferredSize(new java.awt.Dimension(650, 400));

        Configuração.setMaximumSize(new java.awt.Dimension(650, 400));
        Configuração.setPreferredSize(new java.awt.Dimension(650, 400));

        jLabel1.setText("Posicionamento do ligante e tamanho da grade");

        jLabel2.setText("Ligante");

        jLabel3.setText("Grade");

        jLabel4.setText("X");

        jLabel5.setText("Y");

        jLabel6.setText("Z");

        jLabel7.setText("X");

        jLabel8.setText("Y");

        jLabel9.setText("Z");

        jLabel10.setText("Seleção do diretorio do ligante e da proteína");

        bPesquisarProteina.setText("Pesquisar");

        bPesquisarLigante.setText("Pesquisar");

        bGravaConfig.setText("Criar  arquivo de configuração");
        bGravaConfig.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bGravaConfigActionPerformed(evt);
            }
        });

        bLerConfig.setText("Ler arquivo de configuração");

        bExecutaVina.setText("Executar o Vina");

        javax.swing.GroupLayout ConfiguraçãoLayout = new javax.swing.GroupLayout(Configuração);
        Configuração.setLayout(ConfiguraçãoLayout);
        ConfiguraçãoLayout.setHorizontalGroup(
            ConfiguraçãoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 688, Short.MAX_VALUE)
            .addGroup(ConfiguraçãoLayout.createSequentialGroup()
                .addGroup(ConfiguraçãoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(ConfiguraçãoLayout.createSequentialGroup()
                        .addGap(69, 69, 69)
                        .addGroup(ConfiguraçãoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(ConfiguraçãoLayout.createSequentialGroup()
                                .addGroup(ConfiguraçãoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(pathLigante)
                                    .addComponent(pathProteina, javax.swing.GroupLayout.PREFERRED_SIZE, 461, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(ConfiguraçãoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(bPesquisarLigante, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(bPesquisarProteina)))
                            .addGroup(ConfiguraçãoLayout.createSequentialGroup()
                                .addGap(96, 96, 96)
                                .addComponent(bGravaConfig)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(bLerConfig))
                            .addGroup(ConfiguraçãoLayout.createSequentialGroup()
                                .addGap(230, 230, 230)
                                .addComponent(bExecutaVina))))
                    .addGroup(ConfiguraçãoLayout.createSequentialGroup()
                        .addGap(224, 224, 224)
                        .addComponent(jLabel10))
                    .addGroup(ConfiguraçãoLayout.createSequentialGroup()
                        .addGap(221, 221, 221)
                        .addComponent(jLabel1)))
                .addContainerGap(78, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ConfiguraçãoLayout.createSequentialGroup()
                .addGap(0, 137, Short.MAX_VALUE)
                .addGroup(ConfiguraçãoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(ConfiguraçãoLayout.createSequentialGroup()
                        .addGap(60, 60, 60)
                        .addComponent(jLabel2)
                        .addGap(227, 227, 227)
                        .addComponent(jLabel3))
                    .addGroup(ConfiguraçãoLayout.createSequentialGroup()
                        .addGroup(ConfiguraçãoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(ConfiguraçãoLayout.createSequentialGroup()
                                .addComponent(jLabel4)
                                .addGap(18, 18, 18)
                                .addComponent(center_x, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(ConfiguraçãoLayout.createSequentialGroup()
                                .addComponent(jLabel6)
                                .addGap(18, 18, 18)
                                .addComponent(center_z, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(ConfiguraçãoLayout.createSequentialGroup()
                                .addComponent(jLabel5)
                                .addGap(18, 18, 18)
                                .addComponent(center_y, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(126, 126, 126)
                        .addGroup(ConfiguraçãoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(ConfiguraçãoLayout.createSequentialGroup()
                                .addComponent(jLabel8)
                                .addGap(18, 18, 18)
                                .addComponent(sizeY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(ConfiguraçãoLayout.createSequentialGroup()
                                .addComponent(jLabel7)
                                .addGap(18, 18, 18)
                                .addComponent(sizeX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(ConfiguraçãoLayout.createSequentialGroup()
                                .addComponent(jLabel9)
                                .addGap(18, 18, 18)
                                .addComponent(sizeZ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addGap(145, 145, 145))
            .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 688, Short.MAX_VALUE)
        );

        ConfiguraçãoLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {center_x, center_y, center_z, sizeX, sizeY, sizeZ});

        ConfiguraçãoLayout.setVerticalGroup(
            ConfiguraçãoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ConfiguraçãoLayout.createSequentialGroup()
                .addGap(9, 9, 9)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(ConfiguraçãoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(ConfiguraçãoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(center_x, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(sizeX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4)
                    .addComponent(jLabel7))
                .addGap(10, 10, 10)
                .addGroup(ConfiguraçãoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(center_y, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5)
                    .addComponent(sizeY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(ConfiguraçãoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(center_z, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6)
                    .addComponent(sizeZ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addGap(11, 11, 11)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel10)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(ConfiguraçãoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(bPesquisarLigante)
                    .addComponent(pathLigante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(ConfiguraçãoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(bPesquisarProteina)
                    .addComponent(pathProteina, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(ConfiguraçãoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(bLerConfig)
                    .addComponent(bGravaConfig))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(bExecutaVina)
                .addContainerGap(31, Short.MAX_VALUE))
        );

        Abas.addTab("Configuração", Configuração);

        GeraPlanilha.setMaximumSize(new java.awt.Dimension(650, 400));
        GeraPlanilha.setPreferredSize(new java.awt.Dimension(650, 400));

        bPesquisar.setText("Pesquisar");
        bPesquisar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bPesquisarActionPerformed(evt);
            }
        });

        cSaida.setColumns(20);
        cSaida.setEditable(false);
        cSaida.setRows(5);
        jScrollPane3.setViewportView(cSaida);

        cCaminho.setToolTipText("");

        jLabel11.setText("Desenvolvido por: Érica Reis");
        jLabel11.setEnabled(false);

        bListarMelhores.setText("Listar");
        bListarMelhores.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bListarMelhoresActionPerformed(evt);
            }
        });

        jLabel13.setText("Listar");

        jLabel14.setText("melhores casos");

        jLabel15.setText("Listar");

        jLabel16.setText("piores casos");

        bListarPiores.setText("Listar");
        bListarPiores.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bListarPioresActionPerformed(evt);
            }
        });

        bLimparT.setText("Limpar");
        bLimparT.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bLimparTActionPerformed(evt);
            }
        });

        bGeraPlanilha.setText("Gerar Planilha");

        bTodosOsCasos.setText("Todos os casos");
        bTodosOsCasos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bTodosOsCasosActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout GeraPlanilhaLayout = new javax.swing.GroupLayout(GeraPlanilha);
        GeraPlanilha.setLayout(GeraPlanilhaLayout);
        GeraPlanilhaLayout.setHorizontalGroup(
            GeraPlanilhaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(GeraPlanilhaLayout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addGroup(GeraPlanilhaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel11)
                    .addGroup(GeraPlanilhaLayout.createSequentialGroup()
                        .addComponent(cCaminho, javax.swing.GroupLayout.PREFERRED_SIZE, 420, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(bPesquisar))
                    .addGroup(GeraPlanilhaLayout.createSequentialGroup()
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 295, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(GeraPlanilhaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, GeraPlanilhaLayout.createSequentialGroup()
                                .addComponent(jLabel15)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(caixaLP, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(GeraPlanilhaLayout.createSequentialGroup()
                                .addComponent(jLabel13)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(caixaLM, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(GeraPlanilhaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel16)
                            .addGroup(GeraPlanilhaLayout.createSequentialGroup()
                                .addComponent(jLabel14)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(GeraPlanilhaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(bListarMelhores, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE)
                                    .addComponent(bListarPiores, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(bTodosOsCasos, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(bLimparT, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(bGeraPlanilha, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))))
                .addContainerGap(31, Short.MAX_VALUE))
        );
        GeraPlanilhaLayout.setVerticalGroup(
            GeraPlanilhaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(GeraPlanilhaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(GeraPlanilhaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cCaminho, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bPesquisar))
                .addGap(15, 15, 15)
                .addGroup(GeraPlanilhaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(GeraPlanilhaLayout.createSequentialGroup()
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 286, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel11))
                    .addGroup(GeraPlanilhaLayout.createSequentialGroup()
                        .addGroup(GeraPlanilhaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel14)
                            .addComponent(bListarMelhores)
                            .addComponent(caixaLM, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel13))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(GeraPlanilhaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(bListarPiores)
                            .addComponent(caixaLP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel15)
                            .addComponent(jLabel16))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(bTodosOsCasos)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(bLimparT)
                        .addGap(73, 73, 73)
                        .addComponent(bGeraPlanilha)))
                .addContainerGap(42, Short.MAX_VALUE))
        );

        Abas.addTab("Gerar Planilha", GeraPlanilha);

        VizualizaDados.setMaximumSize(new java.awt.Dimension(650, 400));
        VizualizaDados.setPreferredSize(new java.awt.Dimension(650, 400));

        cCaminho1.setToolTipText("");

        bPesquisar1.setText("Pesquisar");
        bPesquisar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bPesquisar1ActionPerformed(evt);
            }
        });

        bLimparT1.setText("Limpar tudo");
        bLimparT1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bLimparT1ActionPerformed(evt);
            }
        });

        jScrollPane4.setMaximumSize(new java.awt.Dimension(20, 25));
        jScrollPane4.setMinimumSize(new java.awt.Dimension(20, 25));
        jScrollPane4.setPreferredSize(new java.awt.Dimension(20, 25));

        cSaida1.setColumns(20);
        cSaida1.setEditable(false);
        cSaida1.setRows(5);
        jScrollPane4.setViewportView(cSaida1);

        cSaida2.setColumns(20);
        cSaida2.setEditable(false);
        cSaida2.setRows(5);
        jScrollPane5.setViewportView(cSaida2);

        jButton1.setText("Alternar Orientação");

        javax.swing.GroupLayout VizualizaDadosLayout = new javax.swing.GroupLayout(VizualizaDados);
        VizualizaDados.setLayout(VizualizaDadosLayout);
        VizualizaDadosLayout.setHorizontalGroup(
            VizualizaDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(VizualizaDadosLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(VizualizaDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(VizualizaDadosLayout.createSequentialGroup()
                        .addComponent(cCaminho1, javax.swing.GroupLayout.PREFERRED_SIZE, 410, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(bPesquisar1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(bLimparT1))
                    .addGroup(VizualizaDadosLayout.createSequentialGroup()
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 518, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jButton1))
                .addGap(0, 13, Short.MAX_VALUE))
        );
        VizualizaDadosLayout.setVerticalGroup(
            VizualizaDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(VizualizaDadosLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(VizualizaDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cCaminho1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bPesquisar1)
                    .addComponent(bLimparT1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton1)
                .addGap(4, 4, 4)
                .addGroup(VizualizaDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 286, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 286, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(41, Short.MAX_VALUE))
        );

        Abas.addTab("Vizualiza Dados", VizualizaDados);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(Abas, javax.swing.GroupLayout.DEFAULT_SIZE, 700, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(Abas, javax.swing.GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void bPesquisarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bPesquisarActionPerformed

        String caminho="";
            try {

                JFileChooser jfc=new JFileChooser();
                jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
                if(jfc.showOpenDialog(null)==JFileChooser.APPROVE_OPTION){
                    caminho+=jfc.getSelectedFile().getAbsoluteFile().toString();
                    BuscaArquivo busca = new BuscaArquivo(caminho.trim());
                    cSaida.setText(busca.ordenaSaida());
                    cCaminho.setText(caminho);
                }

            }catch(CaminhoIncorreto e) {
                JOptionPane.showMessageDialog(null, "Por favor, digite um caminho válido", "Erro", JOptionPane.ERROR_MESSAGE);
            }catch(NaoEhDiretorio e){
                JOptionPane.showMessageDialog(null, "O caminho indicado nao corresponde a um diretorio válido", "Erro", JOptionPane.ERROR_MESSAGE);
            }catch(IOException e) {
                JOptionPane.showMessageDialog(null, "O arquivo não existe. Por favor, verifique o caminho dado", "Erro", JOptionPane.ERROR_MESSAGE);
            }

    }//GEN-LAST:event_bPesquisarActionPerformed

    private void bListarMelhoresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bListarMelhoresActionPerformed
        cSaida.setText("");
        caixaLP.setText("");
        try {
            String saida = "";
            int num;
            BuscaArquivo busca = new BuscaArquivo(cCaminho.getText().trim());
            num = Integer.parseInt(caixaLM.getText().trim());
            saida = busca.ordenaSaida();
            cSaida.setText(busca.listaMelhores(num, saida));

        } catch (CaminhoIncorreto e) {
            JOptionPane.showMessageDialog(null, "Por favor, digite um caminho válido", "Erro", JOptionPane.ERROR_MESSAGE);
        } catch (NaoEhDiretorio e) {
            JOptionPane.showMessageDialog(null, "O caminho indicado nao corresponde a um diretorio válido", "Erro", JOptionPane.ERROR_MESSAGE);
        } catch (IllegalArgumentException e) {
            JOptionPane.showMessageDialog(null, "Por favor, digite um valor válido", "Erro", JOptionPane.ERROR_MESSAGE);
        } catch (IOException e) {
            JOptionPane.showMessageDialog(null, "O arquivo não existe. Por favor, verifique o caminho dado", "Erro", JOptionPane.ERROR_MESSAGE);
        } catch (IndiceInvalido e) {
            JOptionPane.showMessageDialog(null, "Por favor, digite um valor válido", "Erro", JOptionPane.ERROR_MESSAGE);
        }

    }//GEN-LAST:event_bListarMelhoresActionPerformed

    private void bListarPioresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bListarPioresActionPerformed
        cSaida.setText("");
        caixaLM.setText("");
        try {
            String saida = "";
            int num;
            BuscaArquivo busca = new BuscaArquivo(cCaminho.getText().trim());
            num = Integer.parseInt(caixaLP.getText().trim());
            saida = busca.ordenaSaida();
            cSaida.setText(busca.listaPiores(num, saida));

        } catch (CaminhoIncorreto e) {
            JOptionPane.showMessageDialog(null, "Por favor, digite um caminho válido", "Erro", JOptionPane.ERROR_MESSAGE);
        } catch (NaoEhDiretorio e) {
            JOptionPane.showMessageDialog(null, "O caminho indicado nao corresponde a um diretorio válido", "Erro", JOptionPane.ERROR_MESSAGE);
        } catch (IllegalArgumentException e) {
            JOptionPane.showMessageDialog(null, "Por favor, digite um valor válido", "Erro", JOptionPane.ERROR_MESSAGE);
        } catch (IOException e) {
            JOptionPane.showMessageDialog(null, "O arquivo não existe. Por favor, verifique o caminho dado", "Erro", JOptionPane.ERROR_MESSAGE);
        } catch (IndiceInvalido e) {
            JOptionPane.showMessageDialog(null, "Por favor, digite um valor válido", "Erro", JOptionPane.ERROR_MESSAGE);
        }

    }//GEN-LAST:event_bListarPioresActionPerformed

    private void bLimparTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bLimparTActionPerformed
        cSaida.setText("");
        caixaLM.setText("");
        caixaLP.setText("");
    }//GEN-LAST:event_bLimparTActionPerformed

    private void bPesquisar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bPesquisar1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_bPesquisar1ActionPerformed

    private void bLimparT1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bLimparT1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_bLimparT1ActionPerformed

    private void bGravaConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bGravaConfigActionPerformed
            try {
                BuscaArquivo busca = new BuscaArquivo(cCaminho.getText().trim());
                busca.geraConfig();
            }catch(CaminhoIncorreto e) {
                JOptionPane.showMessageDialog(null, "Por favor, digite um caminho válido", "Erro", JOptionPane.ERROR_MESSAGE);
            }catch(NaoEhDiretorio e){
                JOptionPane.showMessageDialog(null, "O caminho indicado nao corresponde a um diretorio válido", "Erro", JOptionPane.ERROR_MESSAGE);
            }catch(IOException e) {
                JOptionPane.showMessageDialog(null, "O arquivo não existe. Por favor, verifique o caminho dado", "Erro", JOptionPane.ERROR_MESSAGE);
            }
    }//GEN-LAST:event_bGravaConfigActionPerformed

    private void bTodosOsCasosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bTodosOsCasosActionPerformed
        try {
            BuscaArquivo busca = new BuscaArquivo(cCaminho.getText().trim());
            cSaida.setText(busca.ordenaSaida());
        } catch (CaminhoIncorreto e) {
            JOptionPane.showMessageDialog(null, "Por favor, digite um caminho válido", "Erro", JOptionPane.ERROR_MESSAGE);
        } catch (NaoEhDiretorio e) {
            JOptionPane.showMessageDialog(null, "O caminho indicado nao corresponde a um diretorio válido", "Erro", JOptionPane.ERROR_MESSAGE);
        } catch (IOException e) {
            JOptionPane.showMessageDialog(null, "O arquivo não existe. Por favor, verifique o caminho dado", "Erro", JOptionPane.ERROR_MESSAGE);
        }
    }//GEN-LAST:event_bTodosOsCasosActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Principal().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTabbedPane Abas;
    private javax.swing.JPanel Configuração;
    private javax.swing.JPanel GeraPlanilha;
    private javax.swing.JPanel VizualizaDados;
    private javax.swing.JButton bExecutaVina;
    private javax.swing.JButton bGeraPlanilha;
    private javax.swing.JButton bGravaConfig;
    private javax.swing.JButton bLerConfig;
    private javax.swing.JButton bLimparT;
    private javax.swing.JButton bLimparT1;
    private javax.swing.JButton bListarMelhores;
    private javax.swing.JButton bListarPiores;
    private javax.swing.JButton bPesquisar;
    private javax.swing.JButton bPesquisar1;
    private javax.swing.JButton bPesquisarLigante;
    private javax.swing.JButton bPesquisarProteina;
    private javax.swing.JButton bTodosOsCasos;
    private javax.swing.JTextField cCaminho;
    private javax.swing.JTextField cCaminho1;
    private javax.swing.JTextArea cSaida;
    private javax.swing.JTextArea cSaida1;
    private javax.swing.JTextArea cSaida2;
    private javax.swing.JTextField caixaLM;
    private javax.swing.JTextField caixaLP;
    private javax.swing.JTextField center_x;
    private javax.swing.JTextField center_y;
    private javax.swing.JTextField center_z;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JTextField pathLigante;
    private javax.swing.JTextField pathProteina;
    private javax.swing.JTextField sizeX;
    private javax.swing.JTextField sizeY;
    private javax.swing.JTextField sizeZ;
    // End of variables declaration//GEN-END:variables
}
